1. 变量
  • 必须由数字,字母,下划线任意组合,且不能数字开头。(可以使用中文命名但不要这样使用)
  • 尽量不要与 Python 自带的函数名重复 例如 list() str() float()
  • 不能是python中的关键字。
['and', 'as', 'assert', 'break', 'class', 'continue','def', 'del', 'elif', 'else', 'except', 'exec','finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', while', 'with', 'yield']
2. 常量
  • Python中没有专门定义常量的方法本质还是变量 约定俗成常量名全部大写